package cn.lblbc.appstore

import android.content.IntentFilter
import cn.lblbc.appstore.utils.PackageReceiver
import cn.lblbc.lib.LblApplication
import cn.lblbc.lib.download.FileDownloadManager


class AppStoreApplication : LblApplication() {

    override fun onCreate() {
        super.onCreate()
        FileDownloadManager.init(this)
        registerPackageReceiver()
    }

    /**
     * 监听系统卸载和安装
     */
    private fun registerPackageReceiver() {
        val filter = IntentFilter()
        filter.addAction("android.intent.action.PACKAGE_ADDED")
        filter.addAction("android.intent.action.PACKAGE_REMOVED")
        filter.addAction("android.intent.action.PACKAGE_REPLACED")
        filter.addDataScheme("package")
        registerReceiver(PackageReceiver(), filter)
    }

}